Itential Automation Gateway

On this page:

Netmiko Integration

Netmiko is a multi-vendor library to simplify Paramiko SSH connections primarily to network devices. It is maintained by Kirk Beyers and built on top of the Paramiko library. Network engineers and developers can use Netmiko to interact with a wide range of devices over SSH. Most audits, commands, or configurations can be pushed or retrieved with nothing but connection and authentication details. However, should a more advanced connectivity configuration be required (custom timeouts, retries, etc), Netmiko also supports additional parameters based upon its underlying Paramiko library.

For more information on Netmiko, please visit the Netmiko PyPi or Netmiko Docs pages.

Automation Gateway (AG) contains a Netmiko Execution Engine that supports pulling or pushing of arbitrary commands or configurations via the send_command and send_config endpoints.

Note: Netmiko version 3.0 is the minimum version supported by Automation Gateway.

Inventory

Netmiko does not have any explicit notion of inventory systems or files. Instead, it accepts a set of connection options which it uses to connect at runtime (host, port, authentication details, etc).

Execution

Netmiko functions are executed by issuing a POST request to the appropriate endpoint ex. /api/v2.0/netmiko/send_{command|config}. Executing a function can be done using the Automation Gateway UI or by a separate application via Automation Gateway API. Functions are executed on the node on which the AG server is running.

Endpoint Arguments

Netmiko endpoints in Automation Gateway require three distinct arguments to interact with remote devices: a host, connection options, and router commands/configs.

Host

The host is either an IP address or a hostname which can be resolved via DNS on the server that Automation Gateway is running on.

Example

host="192.168.0.1"
host="CSR-MIAMI-01"
host="CSR-MIAMI-01.domain.com"

Connection Options

The connection_options is a dictionary which can map directly to Netmiko's ConnectHandler arguments, both in required parameters and parameter types such as port=int(). Because host is a top level argument, it is excluded in this dictionary and will be overwritten if included.

Example

connection_options = {
  "device_type": "cisco_ios",
  "host": "192.168.0.1",
  "port": 22,
  "username": "admin",
  "password": "VerySecurePassword",
  # ...
}

Common Device Types

The device_type is supplied via the device_type parameter in connection_options.

See the links below for details regarding Netmiko support of various vendors platforms.

Example

Alcatel|Nokia SROS: "nokia_sros",
Arista EOS: "arista_eos",
Cisco IOS: "cisco_ios",
Cisco IOSXR: "cisco_xr",
Cisco NXOS: "cisco_nxos",
Juniper Junos: "juniper_junos"

Router Commands and Config

Any environment-specific commands or config can be supplied transactionally (one command/config line per API call) or in a batch (performance may vary; see the Script Execution Engine guide for a better alternative for large command/config sets or prebuilt scripts).

Example

commands = [
  "show version",
  "show interfaces"
]

config = [
  "enable",
  "terminal length 0",
  "interface Ethernet1/1",
  "  no switchport",
  "  ip address 192.168.1.1/24",
  "  mtu 9216",
  "  end",
  "copy running-configuration startup-configuration"
]